/**
 */
package wcomm_v1.impl;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

import wcomm_v1.Event;
import wcomm_v1.EventGeneration;
import wcomm_v1.InMessage;
import wcomm_v1.Wcomm_v1Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Event</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link wcomm_v1.impl.EventImpl#getTriggeredByActivities <em>Triggered By Activities</em>}</li>
 *   <li>{@link wcomm_v1.impl.EventImpl#getTriggeredByMessage <em>Triggered By Message</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EventImpl extends NamedElementImpl implements Event
{
  /**
   * The cached value of the '{@link #getTriggeredByActivities() <em>Triggered By Activities</em>}' reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTriggeredByActivities()
   * @generated
   * @ordered
   */
  protected EList<EventGeneration> triggeredByActivities;

  /**
   * The cached value of the '{@link #getTriggeredByMessage() <em>Triggered By Message</em>}' reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTriggeredByMessage()
   * @generated
   * @ordered
   */
  protected EList<InMessage> triggeredByMessage;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected EventImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Wcomm_v1Package.Literals.EVENT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<EventGeneration> getTriggeredByActivities()
  {
    if (triggeredByActivities == null)
    {
      triggeredByActivities = new EObjectResolvingEList<EventGeneration>(EventGeneration.class, this, Wcomm_v1Package.EVENT__TRIGGERED_BY_ACTIVITIES);
    }
    return triggeredByActivities;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<InMessage> getTriggeredByMessage()
  {
    if (triggeredByMessage == null)
    {
      triggeredByMessage = new EObjectResolvingEList<InMessage>(InMessage.class, this, Wcomm_v1Package.EVENT__TRIGGERED_BY_MESSAGE);
    }
    return triggeredByMessage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_ACTIVITIES:
        return getTriggeredByActivities();
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_MESSAGE:
        return getTriggeredByMessage();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_ACTIVITIES:
        getTriggeredByActivities().clear();
        getTriggeredByActivities().addAll((Collection<? extends EventGeneration>)newValue);
        return;
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_MESSAGE:
        getTriggeredByMessage().clear();
        getTriggeredByMessage().addAll((Collection<? extends InMessage>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_ACTIVITIES:
        getTriggeredByActivities().clear();
        return;
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_MESSAGE:
        getTriggeredByMessage().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_ACTIVITIES:
        return triggeredByActivities != null && !triggeredByActivities.isEmpty();
      case Wcomm_v1Package.EVENT__TRIGGERED_BY_MESSAGE:
        return triggeredByMessage != null && !triggeredByMessage.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //EventImpl
